package com.yst.suivi.comparator;

import java.util.Comparator;

import com.yst.suivi.data.util.NamedObject;

public class NameObjectComparator implements Comparator
{
    public final static NameObjectComparator comparator = new NameObjectComparator();

    /*
     * (non-Javadoc)
     * 
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    public int compare(Object arg0, Object arg1)
    {
    	int retour = 0;
    	NamedObject obj1, obj2;
    	if (arg0 instanceof NamedObject && arg1 instanceof NamedObject)
    	{
    		obj1 = (NamedObject)arg0;
    		obj2 = (NamedObject)arg1;
    		retour = obj1.getNom().compareTo(obj2.getNom());
    	}
        return retour;
    }
}
